import { createRouter, createWebHistory } from 'vue-router'

import GIS from '../views/GIS/index.vue'
import BusinessView from '@/views/yewuguanli/BusinessView.vue'
import Prmg from '@/views/prmg/index.vue'
import WaterView from '@/views/water/index.vue'
import archiveIndexView from '@/views/filemanagement/archiveIndexView.vue'
import HomeCom from '@/views/HomeCom.vue'
import archiveView from '@/views/filemanagement/archiveView.vue'

export const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index.vue')
  },

  {
    path: '/',
    name: 'home',
    meta: {
      label: '首页'
    },
    component: HomeCom,
    children: [
      {
        path: 'hometotal',
        meta: {
          label: '总览'
        },
        name: 'homeTotal',
        component: () => import('@/views/home/HomeTotalView.vue'),
      },
      {
        path: 'gis/fountain',
        name: 'fountain',
        component: () => import('@/views/GIS/fountain.vue')
      },
      {
        path: 'gis/waterPlant',
        name: 'waterPlant',
        component: () => import('@/views/GIS/waterPlant.vue')
      },
      {
        path: 'maintenance/dataScreening',
        name: 'dataScreening',
        component: () => import('@/views/maintenance/dataScreening.vue')
      },
      {
        path: 'maintenance/orderAssign',
        name: 'orderAssign',
        component: () => import('@/views/maintenance/orderAssign.vue')
      },
      {
        path: 'maintenance/staffManage',
        name: 'staffManage',
        component: () => import('@/views/maintenance/staffManage.vue')
      },
      {
        path: 'prmg/ecgs',
        name: 'ecgs',
        component: () => import('@/views/prmg/index.vue')
      },
      {
        path: 'yuwu/rewvenue',
        name: 'rewvenue',
        component: () => import('@/views/yewuguanli/Revenue.vue')
      },
      {
        path: 'yuwu/dma',
        name: 'dma',
        component: () => import('@/views/yewuguanli/DMA.vue')
      },
      {
        path: '/water',
        name: 'water',
        component: WaterView,
      },
      {
        path: '/archiveindex',
        name: 'archive',
        component: archiveView
      },
      {
        path: 'archiveindex/knowledge',
        name: 'knowledge',
        component: () => import('@/views/filemanagement/knowledgeView.vue')
      },
      {
        path: 'spareParts/basic',
        name: 'basic',
        component: () => import('@/views/spareParts/basic.vue')
      }
    ],
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (About.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import('../views/AboutView.vue'),
  }, /* {
    path: '/water',
    name: 'water',
    component: WaterView,
  } */
]


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})


export default router
